;Dogleg existing vertical leaders and text in profiles.
;
;	AUTHOR: HENRY C. FRANCIS
;		425 N. ASHE ST.
;		SOUTHERN PINES, NC 28387
;              
;		All rights reserved without prejudice.
;
;	Copyright:	3-16-95
;	Edited:		3-16-95
;
(DEFUN C:DOGL ( / dldir lnlay dlorg orend dldis pt01 pt02 pt03 dpstr)
  (setq dimsc (getvar"dimscale"))
  (setq clayr (getvar"clayer"))
(while
  (not
    (and
      (setq dltxt (car(entsel "\nSelect Text: ")))
      (setq dllin (car(entsel "\nSelect Line: ")))
      (setq istxt (eq "TEXT"(cdr(assoc 0 (entget dltxt)))))
      (setq islin (eq "LINE"(cdr(assoc 0 (entget dllin)))))
    );and
  );not
  (progn
    (if istxt nil (prompt "\nNot Text or Text not selected first! "))
    (if islin nil (prompt "\nNot a Line or Line not selected second! "))
  );progn
);while
  (setq txstr (cdr(assoc 1 (entget dltxt))))
  (setq txhgt (cdr(assoc 40 (entget dltxt))))
  (setq txlay (cdr(assoc 8 (entget dltxt))))
  (setq lnlay (cdr(assoc 8 (entget dllin))))
  (setq dlorg (trans(cdr(assoc 10 (entget dllin))) 0 1))
  (setq orend (trans(cdr(assoc 11 (entget dllin))) 0 1))
  (setq teofx (car orend))
  (if teoff
    (setq teoff (cons teofx (cdr teoff)))
  );if
  (setq pt01 (polar dlorg (/ pi 2.00)(* 0.375 dimsc)))
  (setq teoff (upoint 1 "" "Top End and offset side" teoff teoff))
  (if (>= (car teoff)(car orend))
    (progn
      (setq pt02 (polar pt01 (/ pi 4.00)(* 0.5 dimsc)))
      (setq dpstr (strcat "@" (rtos(*(sin(/ pi 4.000))0.5 dimsc))",0"))
    );progn
    (progn
      (setq pt02 (polar pt01 (/(* 3 pi)4.00)(* 0.5 dimsc)))
      (setq dpstr (strcat "@" (rtos(*(sin(/ pi 4.000))-0.5 dimsc))",0"))
    );progn
  );if
  (setq dldis (distance pt02 (cons (car pt01)(cdr teoff))))
  (setq pt03 (polar pt02 (/ pi 2.00) dldis))
  (setq txpt (polar pt03 pi(* txhgt 0.625)))
  (command ".erase" dllin dltxt "")
  (setvar "clayer" txlay)
  (command ".text" "j" "r" txpt txhgt "90" txstr)
  (setvar "clayer" lnlay)
  (command ".pline" dlorg pt01 pt02 pt03 "")
  (setvar "clayer" clayr)
);defun
